﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ChairtyBank.DAL;

namespace ChairtyBank
{
    public partial class testCustomerForm : Form
    {
        public testCustomerForm()
        {
            InitializeComponent();
        }

        private void label3_Click(object sender, EventArgs e)
        {
           
        }

        private void btn_add_Click(object sender, EventArgs e)
        {
            CustomerEntity c = new CustomerEntity();

            c.Id = Int32.Parse(txt_id.Text);
            c.Name = txt_name.Text;
            c.DateOfBirth = (DateTime)pkr_dob.Value;

            Customer.Add(c);

           
        }

        private void btn_update_Click(object sender, EventArgs e)
        {
            CustomerEntity c = new CustomerEntity();

            c.Id = Int32.Parse(txt_id.Text);
            c.Name = txt_name.Text;
            c.DateOfBirth = (DateTime)pkr_dob.Value;

            Customer.Update(c);
        }

        private void btn_delete_Click(object sender, EventArgs e)
        {
            CustomerEntity c = new CustomerEntity();

            c.Id = Int32.Parse(txt_id.Text);
            c.Name = txt_name.Text;
            c.DateOfBirth = (DateTime)pkr_dob.Value;

            Customer.Delete(c.Id);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            List<CustomerEntity> lc = Customer.GetAllClients();
            grid_customer.DataSource = lc;
            grid_customer.Visible = true;
        }

    }
}
